<?php 
	session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>管理员登录</title>
<link rel="stylesheet" type="text/css" href="Public/Css/login.css"/>
<script type="text/javascript" src="Public/Js/jquery.js"></script>
<script type="text/javascript">
	function checkUserForm(){
		var name = $("[name='userName']").val();
		var pwd = $("[name='userPwd']").val();
		var code = $("[name='vCode']").val();
		$.ajax({
			type:"POST",
			url:"LoginChk.php",
			data:"userName="+name+"&vCode="+code+"&userPwd="+pwd,
			dataType:"text", 
			success:function(re){
				if(parseInt(re)==1){
					window.location.href="index.php";
				}else{
					$("#checkDiv").html(re);
				}
             	
			}
			});
	
		return false;
	}
	function changeVCode(){
		var newSrc = $("#VCode").attr("src")+"?rd="+Math.random();
		$("#VCode").attr("src",newSrc);
	}
</script>
</head>
<body>
<div class="loginOut">
	<fieldset>
	<div class="loginImg">
		<font style="color:#3076BB;font:bold 40px '华文彩云'" >Comming Eatting后台管理系统</font>
	</div>
	
	<legend><font style="font-size:20px;color:#FE8C18;">用户登录</font></legend>
	<div class="userTable">
		<form action="LoginChk.php"  method="POST" onsubmit="return checkUserForm();">
			<table border=0>
				<tr>
					<td id="leftTd">账户名</td>
					<td colspan="2" id="textLeft"><input  type="text" name="userName" size="22" style="height:23px;"/></td>
				</tr>
				<tr>
					<td>密　码</td>
					<td colspan="2" id="textLeft"><input type="password" name="userPwd" size="22" style="height:23px;"></td>
				</tr>
				<tr>
					<td>验证码</td>
					<td id="textLeft" width="90px"><input type="text" name="vCode" size="9" style="height:23px;"></td>
					<td id="textLeft"><div><img  id="VCode" style="cursor:pointer;" src="../Public/vcode.php" onclick="changeVCode();"></div></td>
				</tr>
				<tr>
					<td colspan="2" ><input type="image"  src="Public/Images/login.png" ></td>
					<td id="textLeft" ><div><a href="">忘记密码?</a></div></td>
				</tr>
			</table>
		</form>
		<div id="checkDiv"></div>
	</div>
	</fieldset>	
	
</div>

</body>
</html>